<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:text="${schedule?.id} != null ? '编辑排班' : '编辑排班'">编辑医生排班</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">
    <style>
        body {
            background-color: #f9fafb;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        .form-container {
            max-width: 600px;
            margin: 3rem auto;
            padding: 2rem;
            background-color: white;
            border-radius: 0.75rem;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }

        .form-label {
            font-weight: 600;
            color: #1f2937;
        }

        .btn-submit {
            background-color: #3b82f6;
            border-color: #3b82f6;
            transition: all 0.3s ease;
        }

        .btn-submit:hover {
            background-color: #2563eb;
            transform: translateY(-2px);
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        }

        .form-control:focus {
            border-color: #3b82f6;
            box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
        }
    </style>
</head>
<body>

<div class="form-container">
    <h3 class="mb-4" th:text="${schedule != null ? (schedule.id != null ? '编辑医生排班' : '编辑医生排班') : '编辑医生排班'}">
        编辑医生排班信息
    </h3>
    <form th:action="@{/admin/schedule/save}" method="post" th:object="${schedule}" class="space-y-6">
        <!-- 隐藏字段 -->
        <input type="hidden" th:field="*{id}" />

        <div class="mb-3">
            <label for="doctor_id" class="form-label">医生ID</label>
            <input type="text" id="doctor_id" th:field="*{doctor_id}" class="form-control" readonly />
        </div>

        <div class="mb-3">
            <label for="doctor_name" class="form-label">医生姓名</label>
            <input type="text" id="doctor_name" th:field="*{doctor_name}" class="form-control" readonly />
        </div>

        <div class="mb-3">
            <label for="department" class="form-label">科室</label>
            <input type="text" id="department" th:field="*{department}" class="form-control" required />
        </div>

        <div class="mb-3">
            <label for="work_date" class="form-label">值班日期</label>
            <input type="date" id="work_date" th:field="*{work_date}" class="form-control" required />
        </div>

        <div class="mb-3">
            <label for="shift" class="form-label">班次</label>
            <select id="shift" th:field="*{shift}" class="form-select" required>
                <option value="">请选择班次</option>
                <option value="上午" th:selected="${schedule.shift == '上午'}">上午</option>
                <option value="下午" th:selected="${schedule.shift == '下午'}">下午</option>
                <option value="全天" th:selected="${schedule.shift == '全天'}">全天</option>
            </select>
        </div>
        <button type="submit" class="btn btn-primary">保存修改</button>
    </form>

    <a th:href="@{/admin/schedule/list}" class="btn btn-outline-secondary w-100 mt-3">返回列表</a>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
